import numpy as np
import pandas as pd

path = "./data/marketplace.csv"

data = pd.read_csv(path)

print('data size:', data.size, "data.shape:", data.shape)
print('data.columns', data.columns)

FORMAT_COLUMN = 'date'


def format_date(df):
    str_arr = df[FORMAT_COLUMN].split('/', 2)
    return str_arr[2] + '/' + str_arr[0] + '/' + str_arr[1]


'''
 将日期的格式更改为YYYY/MM/DD格式，方便排序
'''

data['date'] = data.apply(format_date, axis=1)

'''
 保存为新的文件
'''
data.to_csv("./data/marketplace_format_date.csv", index=False)
